<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
	function mysqlquery($string)
	{
		$result = mysql_query($string);
		return $result;	
	}
	if(isset($_COOKIE['studialusername']))
	{
		@$connection = mysql_pconnect('localhost', 'root', '');
		if(!$connection)
		{
			echo "Không thể truy cập vào cơ sở dữ liệu, bạn vui lòng thử lại sau";
			exit;
		}
		
		$result = mysqlquery("select * from `coursemembers` where `course_id` = '".$_GET['course_id']."';");
		$num_rows = mysql_num_rows($result);
		if($num_rows != 0)
		{
			for($i = 0 ; $i < $num_rows ; $i ++)
			{
				$row = mysql_fetch_array($result);
				$result1 = mysqlquery("select * from `users` where `id` = '".$row['user_id']."';");
				$row1 = mysql_fetch_array($result1);
				echo $row1['firstname'];
				echo $row1['lastname'];	
			}
		}
		exit;
		
	}

?>
</body>
</html>